<style>
.layui-form-pane .layui-form-label{width:auto;}
.layui-form-item{margin-bottom: 0px;}
.order-time-bg{background-color:#1E9FFF;color:white;padding:0px 5px;}
</style>
<div class="page-toolbar" style="min-height: 100px;">
    <div class=" fixed-bar">
        <form class="layui-form layui-form-pane fixed-bar-form" action="{:url()}" method="get" id="hisi-table-search">
        <div class="layui-form-item">
            <div class="layui-inline removeStat">
                <label class="layui-form-label">日期</label>
                <div class="layui-input-inline">
                    <input type="text" name="date_range"  id="date_range" lay-verify="" placeholder="选择日期" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">SKU</label>
                <div class="layui-input-inline">
                    <input type="text" name="sku"  placeholder="" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">分类</label>
                <div class="layui-input-inline">
                    {:Form::select('type', '', [0=> '请选择',1=>'正常',2=>'将断码',3=>'已断码'], '', '')}
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">来源帐号</label>
                <div class="layui-input-inline">
                    {:Form::select('is_auto_import', '', [''=> '请选择']+config('mimo.order_from'), '', '')}
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">所属父工厂名称</label>
                <div class="layui-input-inline">
                  {:Form::select('factory_id', '', $factoryKV, '', '')}
                </div>
            </div>
            <div class="layui-inline layui-upload">
                <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">搜索</button>

                <button type="button" class="layui-btn layui-btn-normal" id="test8">选择文件</button>
                <button type="button" class="layui-btn layui-btn-primary" id="test9">导入</button>
                <a href="__STATIC__/demo/断码-例子.xls" class="layui-btn layui-btn-primary layui-btn-xs" target="_blank" title="点击下载导入的xls模板"><i class="layui-icon">&#xe702;</i></a>

            </div>
        </div>
        
    </div>
</div>

<table id="dataTable"></table>

{include file="system@block/layui" /}

<script type="text/html" title="操作按钮模板" id="buttonTpl">
    <a href="{:url('edit')}?id={{ d.id }}" class="layui-btn layui-btn-xs layui-btn-normal hisi-iframe" hisi-data="{width: '470px', height: '600px'}" title="修改组别">修改</a>
	<a href="{:url('del')}?id={{ d.id }}" class="layui-btn layui-btn-xs layui-btn-danger j-tr-del">删除</a>
</script>

<script type="text/html" title="排序模板" id="sortTpl">
    <input type="text" class="layui-input hisi-ajax-input input-sort" onkeyup="value=value.replace(/[^\d]/g,'')" value="{{ d.order }}" data-value="{{ d.id }}" data-href="{:url('sort')}?id={{ d.id }}&field=order">
</script>

<script type="text/html" id="toolbar">
    <div class="layui-btn-group fl">
        <a href="{:url('add')}" class="layui-btn layui-btn-primary layui-btn-sm layui-icon layui-icon-add-circle-fine hisi-iframe" hisi-data="{width: '470px', height: '600px'}" title="添加组别">&nbsp;添加</a>
		<a data-href="{:url('del')}" class="layui-btn layui-btn-primary layui-btn-sm j-page-btns confirm layui-icon layui-icon-close red">&nbsp;删除</a>
    </div>
</script>
<script type="text/html" id="updateTimeTpl">
    <div>{{layui.util.toDateString(d.update_time * 1000) }}</div>
</script>
<script src="__PUBLIC_JS__/jquery.2.1.4.min.js?v={:config('hisiphp.version')}"></script>
<script src="__PUBLIC_JS__/xm-select/dist/xm-select.js?v={:config('hisiphp.version')}"></script>
<script type="text/javascript">
    layui.use([ 'element', 'layer', 'laytpl', 'tool','laydate','table','form','flow','upload'], function() {
        var element = layui.element;
        var layer = layui.layer;
        var form = layui.form;
        var laytpl = layui.laytpl,laydate=layui.laydate ,table = layui.table;
        var upload=layui.upload;
        laydate.render({
            elem: '#date_range'
            ,range: '~'
            ,theme: 'molv'
            ,mark: {'{:$today}':''}
            ,change: function(value, date, endDate){
                $('#date_range').val(value);
                $('#layui-laydate1').remove();//关闭面板
            }
        });
        table.render({
            elem: '#dataTable'
            ,url: '{:url()}' //数据接口
            ,page: true //开启分页
            ,skin: 'row'
            ,even: true
            ,limit: 20
            ,limits: [20,50,100,150,200]
            ,text: {
                none : '暂无相关数据'
            }
            ,toolbar: '#toolbar'
            ,defaultToolbar: ['filter', 'exports', 'print']
            ,cols: [[ //表头
                {type:'checkbox', fixed:'left'}
                ,{field: 'id', title: '编号', sort: true}
                ,{field: 'confirm_date', title: '日期', sort: true}
                ,{field: 'sku', title: 'SKU'}
                ,{field: 'factory_name', title: '父工厂名称'}
                ,{field: 'type_txt', title: '分类'}
                ,{field: 'is_auto_import_txt', title: '来源帐号'}
                ,{field: 'average_daily_sales_num', title: '日均销量（件）'}
                ,{field: 'size_day', title: '尺寸天数'}
                ,{title: '操作', templet: '#buttonTpl', fixed: 'right'}
            ]]
        });

        /*
         * 上传导入Excel
         */
        upload.render({
            elem: '#test8'
            ,url: "{:url('import')}" //改成您自己的上传接口
            ,auto: false
            //,multiple: true
            ,bindAction: '#test9'
            , accept: 'file'
            ,done: function(res){
                if(res.code==1){
                    layer.msg(res.msg, {icon: 1,anim: 6});
                }else{
                    layer.confirm(res.msg, {btn: ['导入失败','关闭']}, function(index){
                        layer.close(index);
                    });
                    // layer.msg(res.msg, {icon: 2,anim: 6});
                }
            }
        });
    });
    
    
</script>